#include<bits/stdc++.h>
#define ull unsigned long long
#define endl '\n'
#define debug(x) cerr<<#x<<':'<<x<<endl
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const int N=15;
int n;
int a[N];
int p[N];
int mx,ans;
int tot=0;
ull hsh[N];
map<ull,bool> cnt;
signed main(){
	freopen("palindrome.in","r",stdin);
	freopen("palindrome.out","w",stdout);
    IOS;
    cin>>n;
    for(register int i=1;i<=n;i++) cin>>a[i],p[i]=i;
    do{
        vector<int> v;
        for(register int i=1;i<=n;i++) v.push_back(a[p[i]]),hsh[i]=hsh[i-1]*131+a[p[i]];
        if(cnt[hsh[n]]) continue;
        cnt[hsh[n]]=1;
        int res=0;
        for(register int i=0;i<n;i++){
            register int l=i,r=i;
            while(v[l]==v[r]&&l>=0&&r<n){
                res++;
                l--,r++;
                tot++;
            }
            l=i,r=i+1;
            while(v[l]==v[r]&&l>=0&&r<n){
                res++;
                l--,r++;
                tot++;
            }
        }
        if(res==mx) ans++;
        if(res>mx) mx=res,ans=1;
    }while(next_permutation(p+1,p+n+1));
    cout<<mx<<' '<<ans;
    return 0;
}
